//
//  DynamicCollectionView.swift
//  Lease_IOS
//
//  Created by Mr.Wang on 2019/6/28.
//  Copyright © 2019 Mr.wang. All rights reserved.
//

import UIKit

class DynamicCollectionView: UICollectionView {
    
    override func reloadData() {
        super.reloadData()
        if self.height != self.intrinsicContentSize.height {
            self.layoutIfNeeded()
        }
    }
    
    override func layoutSubviews() {
        super.layoutSubviews()
        self.invalidateIntrinsicContentSize()
    }
    
    override var intrinsicContentSize: CGSize {
        return self.collectionViewLayout.collectionViewContentSize
    }
    
}
